package openmarket.web;

import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

public class HelloController implements Controller {

	protected final Log logger = LogFactory.getLog(getClass());
	private UserRoleDao userRoleDAO;

	public void setUserRoleDAO(UserRoleDao userRoleDAO) {
		this.userRoleDAO = userRoleDAO;
	}

	public ModelAndView handleRequest(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
			UserRole ur = null;
			try {
				ur = userRoleDAO.getUserRole(-1);
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			List list = new ArrayList();
			list.add(ur);
			return new ModelAndView("test", "list", list);
	}

}
